<!-- 设备管理-设备列表页面 -->
<template>
  <div class="app-container">
    <px-form v-show="showSearch" ref="queryRef" class="custom-form-ui" :model="queryParams" :inline="true" label-width="90px">
      <px-form-item label="设施/活动名称">
        <px-select v-model="queryParams.facilityName" placeholder="请选择" clearable style="width: 210px" filterable>
          <px-option v-for="dict in facilityList" :key="dict.id" :label="dict.name" :value="dict.name" />
        </px-select>
      </px-form-item>
      <px-form-item label="排放因子名称">
        <px-select v-model="queryParams.emissionFactorName" placeholder="请选择" clearable style="width: 210px" filterable>
          <px-option v-for="dict in emissionFactorqueryList" :key="dict.id" :label="dict.name" :value="dict.name" />
        </px-select>
      </px-form-item>
      <!-- <px-form-item label="厂区">
        <px-select :disabled="facDisabled" v-model="queryParams.level" placeholder="请选择厂区" clearable style="width: 210px" filterable>
          <px-option v-for="dict in liquidList" :key="dict.itemValue" :label="dict.itemName" :value="dict.itemValue" />
        </px-select>
      </px-form-item> -->
      <px-form-item label="核算月份">
        <px-date-picker
          v-model="queryParams.releaseYear"
          type="monthrange"
          value-format="YYYY-MM-DD HH:mm:ss"
          format="YYYY-MM"
          placeholder="请选择月份"
        />
      </px-form-item>
      <px-button style="margin-top: -17px" type="primary" icon="" @click="handleQuery('search')">搜索</px-button>
      <px-button style="margin-top: -17px" icon="" @click="resetQuery">重置</px-button>
    </px-form>

    <px-row :gutter="10" class="mb8">
      <!-- <px-col :span="1.5">
        <px-button v-has="'FACTOR_ADD'" type="primary" icon="" @click="handleAdd">新增</px-button>
      </px-col>
      <px-col :span="1.5">
        <px-button v-has="'FACTOR_INTO'" type="primary" plain icon="" @click="handleExport">导入</px-button>
      </px-col> -->
    </px-row>
    <px-dialog v-model="dialogVisible" title="导入数据" :width="600">
      <div class="import-bottle">
        <div class="import-bottle-title">
          上传前请先
          <span class="download"> 下载模板 </span>
          ，填写完成后导入数据
        </div>
        <div class="import-bottle-upload">
          <!-- <importFiles v-model="importFile" :params="importParams" :uploadApi="uploadApi" @submit="submitHandler" /> -->
          <importFiles v-model="importFile" @submit="submitHandler" />
        </div>
      </div>
    </px-dialog>
    <px-table v-if="!addVisible && !detailVisible" v-loading="loading" :data="typeList" height="calc(100vh - 319px)" border>
      <px-table-column label="序号" fixed="left" type="index" width="70">
        <template #default="{ $index }">
          {{ $index + 1 + (queryParams.pageNum - 1) * queryParams.pageSize }}
        </template>
      </px-table-column>

      <px-table-column label="设施/活动名称" width="230" prop="name">
        <template #default="scope">
          <span>{{ scope.row.facilityName }}</span>
        </template>
      </px-table-column>

      <px-table-column label="活动水平" prop="gasType">
        <template #default="scope">
          <span>{{ scope.row.activityLevel ? `${scope.row.activityLevel}` : "-" }}</span>
        </template>
      </px-table-column>

      <px-table-column label="活动水平单位" prop="value">
        <template #default="scope">
          <span>{{ scope.row.activityLevelUnit }}</span>
        </template>
      </px-table-column>
      <px-table-column label="排放因子名称" prop="unit">
        <template #default="scope">
          <span>{{ scope.row.emissionFactorName }}</span>
        </template>
      </px-table-column>
      <px-table-column label="排放因子" prop="factorSource">
        <template #default="scope">
          <span>{{ scope.row.emissionFactorValue }}</span>
        </template>
      </px-table-column>
      <px-table-column label="碳排放量（tCO₂e）" width="160" prop="releaseYear">
        <template #default="scope">
          <span>{{ scope.row.carbonEmission }}</span>
        </template>
      </px-table-column>
      <px-table-column align="center" label="告警状态">
        <template #default="scope">
          <span v-if="scope.row.warnStatus == null">-</span>
          <px-tag v-if="scope.row.warnStatus == '正常'" type="success">{{ scope.row.warnStatus }}</px-tag>
          <px-tag v-if="scope.row.warnStatus == '告警'" type="warning">{{ scope.row.warnStatus }}</px-tag>
        </template>
      </px-table-column>
      <!-- <px-table-column label="所属厂区" prop="createByName">
        <template #default="scope">
          <span>{{ scope.row.level }}</span>
        </template>
      </px-table-column> -->
      <px-table-column label="核算月份" prop="outboundTime">
        <template #default="scope">
          <span>{{ scope.row.estimateMonth.split(" ")[0].slice(0, -3) }}</span>
        </template>
      </px-table-column>
      <px-table-column label="填报人" prop="receiveCompany">
        <template #default="scope">
          <span>{{ scope.row.estimateByName }}</span>
        </template>
      </px-table-column>
      <px-table-column label="填报时间" prop="outboundTime">
        <template #default="scope">
          <span>{{ scope.row.estimateTime }}</span>
        </template>
      </px-table-column>
      <px-table-column fixed="right" label="操作" align="center" width="140">
        <template #default="scope">
          <px-button v-has="'ACREENINGFACTOR_DETAIL'" link type="primary" @click="handleDetail(scope.row.activityLevelId)">
            <px-tooltip class="box-item" content="详情" placement="top">
              <px-icon>
                <Tickets />
              </px-icon> </px-tooltip
          ></px-button>
          <px-button
            v-if="scope.row.status != 'INVALID'"
            v-has="'ACREENINGFACTOR_EDITOR'"
            link
            type="primary"
            @click="handleEditor(scope.row.activityLevelId)"
          >
            <px-tooltip class="box-item" content="编辑" placement="top">
              <px-icon>
                <EditPen />
              </px-icon> </px-tooltip
          ></px-button>
          <!-- <px-button v-if="scope.row.status != 'INVALID'" v-has="'FACTOR_DELETE'" link type="danger" @click="handleDelete(scope.row)"
            ><px-tooltip class="box-item" content="删除" placement="top">
              <px-icon><Delete /></px-icon> </px-tooltip
          ></px-button> -->
        </template>
      </px-table-column>
      <template #empty>
        <px-empty :image-size="150" />
      </template>
    </px-table>

    <pagination
      v-if="!equipopen && !equipopenDetail"
      v-show="total > 0"
      v-model:page="queryParams.pageNum"
      v-model:limit="queryParams.pageSize"
      style="margin-bottom: -10px"
      :total="total"
      @pagination="getList"
    />
    <px-scrollbar v-if="addVisible" class="addEquip">
      <px-button style="margin-left: 24px" type="primary" :icon="ArrowLeft" @click="equipopenDetailcancel">返回</px-button>
      <px-button type="primary" plain style="float: right; margin-right: 20px" @click="gethistory()">历史记录</px-button>
      <div class="px-descriptions__title" style="margin: 20px 0 0 20px">基本信息</div>
      <px-descriptions class="margin-top" style="padding: 20px" title="" :column="2" border>
        <px-descriptions-item>
          <template #label>
            <div class="cell-item">所属厂区</div>
          </template>
          {{ equipdata.level }}
        </px-descriptions-item>
        <px-descriptions-item>
          <template #label>
            <div class="cell-item">核算月份</div>
          </template>
          {{ equipdata.estimateMonth }}
        </px-descriptions-item>
        <px-descriptions-item>
          <template #label>
            <div class="cell-item">核算模版</div>
          </template>
          {{ equipdata.templateName }}
        </px-descriptions-item>
        <px-descriptions-item>
          <template #label>
            <div class="cell-item">填报人员</div>
          </template>
          {{ equipdata.estimateByName }}
        </px-descriptions-item>
        <px-descriptions-item>
          <template #label>
            <div class="cell-item">填报时间</div>
          </template>
          {{ equipdata.estimateTime }}
        </px-descriptions-item>
      </px-descriptions>
      <div class="px-descriptions__title" style="margin: 20px 0 0 20px">设施活动信息</div>
      <px-descriptions class="margin-top" style="padding: 20px" title="" :column="2" border>
        <px-descriptions-item>
          <template #label>
            <div class="cell-item">设施/活动</div>
          </template>
          {{ equipdata.facilityName }}
        </px-descriptions-item>
        <px-descriptions-item>
          <template #label>
            <div class="cell-item">类别</div>
          </template>
          {{ equipdata.category }}
          <!-- {{ equipdata.numberatorUnit }}/{{ equipdata.denominatorUnit }} -->
        </px-descriptions-item>
        <!-- <px-descriptions-item>
          <template #label>
            <div class="cell-item">排放类别</div>
          </template>
          {{ equipdata.emissionCategory }}
        </px-descriptions-item> -->
        <px-descriptions-item>
          <template #label>
            <div class="cell-item">排放因子</div>
          </template>
          {{ equipdata.emissionFactorName }}
        </px-descriptions-item>
        <px-descriptions-item>
          <template #label>
            <div class="cell-item">GHG种类</div>
          </template>
          {{ equipdata.gasType }}
          <!-- {{ equipdata.releaseYear }} -->
        </px-descriptions-item>
        <px-descriptions-item>
          <template #label>
            <div class="cell-item"><span style="color: red">*</span>活动水平</div>
          </template>
          <px-input-number
            v-model="equipdata.activityLevel"
            controls-position="right"
            :max="999999999"
            :precision="2"
            style="width: 200px; margin-right: 8px"
            @input="setactivityLevel(equipdata)"
          />
          {{ equipdata.activityLevelUnit }}
        </px-descriptions-item>
        <px-descriptions-item>
          <template #label>
            <div class="cell-item"><span style="color: red">*</span>活动水平数据来源</div>
          </template>
          <px-select v-model="equipdata.activityLevelSource" placeholder="请选择" clearable style="width: 240px" filterable>
            <px-option v-for="dict in huodongList" :key="dict" :label="dict" :value="dict" />
          </px-select>
        </px-descriptions-item>
        <!-- <px-descriptions-item>
          <template #label>
            <div class="cell-item">凭证材料</div>
          </template>
          {{ equipdata.releaseYear }}
        </px-descriptions-item> -->
      </px-descriptions>
      <div style="margin: 0 20px">
        <div style="margin-bottom: 10px">凭证材料</div>
        <FileUpload
          v-if="equipdata.activityLevelSource != '缴费凭证'"
          fileType="add"
          :fileSize="999"
          fileAccept=".pdf"
          fileTypeValue="pdf"
          :fileData="{ moduleName: 'ACCOUNTING_MANAGE' }"
          :fileList="equipdata.fileDTOS"
          @changeFileList="changeFileList"
          @saveFileStatus="saveFileStatus"
        />
        <div v-else>
          <px-button type="primary" plain style="margin-bottom: 16px" @click="setpzfile(equipdata)">选择缴费凭证</px-button>
          <FileUpload
            fileType="view"
            :fileSize="10"
            :countLimit="1"
            fileAccept=".pdf"
            fileTypeValue="pdf"
            :fileData="{ moduleName: 'ACCOUNTING_MANAGE' }"
            :fileList="equipdata.fileDTOS"
            @changeFileList="changeFileList"
            @saveFileStatus="saveFileStatus"
          />
        </div>
      </div>
      <div class="px-descriptions__title" style="margin: 20px 0 0 20px">碳排放量</div>
      <div style="padding: 20px; margin-bottom: 150px">
        <div class="mainlist">
          <div class="mainlistTop">
            <px-icon style="margin-top: 4px; cursor: pointer" color="#3B82F6">
              <AddRectangle />
            </px-icon>
            <p class="mainlistTopp">
              碳排放量（tCO₂e）：<span style="color: #3b82f6">{{ equipdata.totalCarbonEmission }}</span>
              <span style="margin-left: 16px">环比</span>
              <span v-if="equipdata.monthOnMonthRatio != null">
                <span v-if="equipdata.monthOnMonthRatio > 0" style="margin-left: 8px; color: #f87171">{{ equipdata.monthOnMonthRatio }}%</span>
                <px-icon v-if="equipdata.monthOnMonthRatio > 0" color="#F87171" style="font-size: 12px !important">
                  <Top />
                </px-icon>
                <px-icon v-if="equipdata.monthOnMonthRatio >= 30" color="#f59e0b" style="font-size: 12px !important; cursor: pointer">
                  <px-tooltip class="box-item" effect="dark" content="环比变化超过30%" placement="top"> <WarningFilled /> </px-tooltip>
                </px-icon>
                <span v-if="equipdata.monthOnMonthRatio < 0" style="margin-left: 8px; color: #10b981">{{ equipdata.monthOnMonthRatio }}%</span>
                <span v-if="equipdata.monthOnMonthRatio == 0" style="margin-left: 8px; color: #000">{{ equipdata.monthOnMonthRatio }}%</span>
                <px-icon v-if="equipdata.monthOnMonthRatio < 0" color="#10b981" style="font-size: 12px !important">
                  <Bottom />
                </px-icon>
              </span>
              <span v-else> --</span>
            </p>
            <div>
              <div v-for="item in equipdata.resultUpdateDTOS" :key="item.id" class="mianListbottom">
                <p class="mianListbottomp" />
                <p class="mianListbottomp2">
                  <span style="display: inline-block; min-width: 200px">{{ item.gasType }}排放因子：{{ item.gasType }}</span>
                  <span style="display: inline-block; min-width: 100px; margin-left: 68px"
                    >{{ item.emissionFactorValue }} {{ equipdata.factorUnit }}</span
                  >
                  <span style="display: inline-block; min-width: 200px; margin-left: 220px">排放量（tCO₂e）：{{ item.carbonEmission }}</span>
                </p>
              </div>
            </div>
          </div>
        </div>
      </div>
      <px-dialog v-model="innerVisible" width="1372" title="历史记录" append-to-body align-center>
        <px-table
          v-loading="loading"
          :data="rukuList"
          height="calc(100vh - 339px)"
          show-overflow-tooltip
          highlight-current-row
          border
          @current-change="handleSelectionChange2"
        >
          <px-table-column label="设施/活动" width="160" prop="inboundNumber">
            <template #default="scope">
              <span>{{ scope.row.facilityName }}</span>
            </template>
          </px-table-column>
          <px-table-column label="活动水平" prop="gasType">
            <template #default="scope">
              <span>{{ scope.row.activityLevel }}{{ scope.row.activityLevelUnit }}</span>
            </template>
          </px-table-column>
          <px-table-column label="活动水平来源" prop="gasType">
            <template #default="scope">
              <span>{{ scope.row.activityLevelSource }}</span>
            </template>
          </px-table-column>
          <px-table-column label="CO₂e排放因子" prop="value">
            <template #default="scope">
              <span>{{ scope.row.co2eFactorValue }}</span>
            </template>
          </px-table-column>
          <px-table-column label="排放总量（tCO₂e）" prop="unit">
            <template #default="scope">
              <span>{{ scope.row.totalCarbonEmission }}</span>
            </template>
          </px-table-column>
          <px-table-column label="环比变化" prop="factorSource">
            <template #default="scope">
              <span>{{ scope.row.momValue }}%</span>
            </template>
          </px-table-column>
          <px-table-column label="活动水平记录方式" prop="gasType">
            <template #default="scope">
              <span>{{ scope.row.activityLevelSource }}</span>
            </template>
          </px-table-column>

          <px-table-column label="凭证材料" prop="factorSource">
            <template #default="scope">
              <span v-if="scope.row.fileDTOS?.length > 0" class="pdfColor" @click="showPdf(scope.row.fileDTOS)">{{
                scope.row.fileDTOS[0].originalName
              }}</span>
              <span v-else>-</span>
            </template>
          </px-table-column>
          <px-table-column label="修改人" prop="factorSource">
            <template #default="scope">
              <span>{{ scope.row.updateByName }}</span>
            </template>
          </px-table-column>
          <px-table-column label="修改时间" prop="factorSource">
            <template #default="scope">
              <span>{{ scope.row.updateTime }}</span>
            </template>
          </px-table-column>
          <template #empty>
            <px-empty :image-size="150" />
          </template>
        </px-table>

        <pagination
          v-show="total2 > 0"
          v-model:page="queryParams2.pageNum"
          v-model:limit="queryParams2.pageSize"
          style="margin-bottom: -10px"
          :total="total2"
          @pagination="getRukuList"
        />
      </px-dialog>
    </px-scrollbar>
    <px-scrollbar v-if="detailVisible" class="editorEquip">
      <px-button style="margin-left: 24px" type="primary" :icon="ArrowLeft" @click="detailVisible = false">返回</px-button>
      <px-button type="primary" plain style="float: right; margin-right: 20px" @click="gethistory()">历史记录</px-button>
      <div class="px-descriptions__title" style="margin: 20px 0 0 20px">基本信息</div>
      <px-descriptions class="margin-top" style="padding: 20px" title="" :column="2" border>
        <px-descriptions-item>
          <template #label>
            <div class="cell-item">所属厂区</div>
          </template>
          {{ equipdata.level }}
        </px-descriptions-item>
        <px-descriptions-item>
          <template #label>
            <div class="cell-item">核算月份</div>
          </template>
          {{ equipdata.estimateMonth }}
        </px-descriptions-item>
        <px-descriptions-item>
          <template #label>
            <div class="cell-item">核算模版</div>
          </template>
          {{ equipdata.templateName }}
        </px-descriptions-item>
        <px-descriptions-item>
          <template #label>
            <div class="cell-item">填报人员</div>
          </template>
          {{ equipdata.estimateByName }}
        </px-descriptions-item>
        <px-descriptions-item>
          <template #label>
            <div class="cell-item">填报时间</div>
          </template>
          {{ equipdata.estimateTime }}
        </px-descriptions-item>
      </px-descriptions>
      <div class="px-descriptions__title" style="margin: 20px 0 0 20px">设施活动信息</div>
      <px-descriptions class="margin-top" style="padding: 20px" title="" :column="2" border>
        <px-descriptions-item>
          <template #label>
            <div class="cell-item">设施/活动</div>
          </template>
          {{ equipdata.facilityName }}
        </px-descriptions-item>
        <px-descriptions-item>
          <template #label>
            <div class="cell-item">类别</div>
          </template>
          {{ equipdata.category }}
          <!-- {{ equipdata.numberatorUnit }}/{{ equipdata.denominatorUnit }} -->
        </px-descriptions-item>
        <!-- <px-descriptions-item>
          <template #label>
            <div class="cell-item">排放类别</div>
          </template>
          {{ equipdata.emissionCategory }}
        </px-descriptions-item> -->
        <px-descriptions-item>
          <template #label>
            <div class="cell-item">排放因子</div>
          </template>
          {{ equipdata.emissionFactorName }}
        </px-descriptions-item>
        <px-descriptions-item>
          <template #label>
            <div class="cell-item">GHG种类</div>
          </template>
          {{ equipdata.gasType }}
          <!-- {{ equipdata.releaseYear }} -->
        </px-descriptions-item>
        <px-descriptions-item>
          <template #label>
            <div class="cell-item">活动水平</div>
          </template>
          {{ equipdata.activityLevel }}{{ equipdata.activityLevelUnit }}
        </px-descriptions-item>
        <px-descriptions-item>
          <template #label>
            <div class="cell-item">活动水平数据来源</div>
          </template>
          {{ equipdata.activityLevelSource }}
        </px-descriptions-item>
        <!-- <px-descriptions-item>
          <template #label>
            <div class="cell-item">凭证材料</div>
          </template>
          {{ equipdata.releaseYear }}
        </px-descriptions-item> -->
      </px-descriptions>
      <div style="margin: 0 20px">
        <div style="margin-bottom: 10px">凭证材料</div>
        <FileUpload
          fileType="view"
          :fileSize="999"
          fileAccept=".pdf"
          fileTypeValue="pdf"
          :fileData="{ moduleName: 'ACCOUNTING_MANAGE' }"
          :fileList="equipdata.fileDTOS"
          @changeFileList="fileDTOS"
          @saveFileStatus="saveFileStatus"
        />
      </div>
      <div class="px-descriptions__title" style="margin: 20px 0 0 20px">碳排放量</div>
      <div style="padding: 20px; margin-bottom: 50px">
        <div class="mainlist">
          <div class="mainlistTop">
            <px-icon style="margin-top: 4px; cursor: pointer" color="#3B82F6">
              <AddRectangle />
            </px-icon>
            <p class="mainlistTopp">
              碳排放量（tCO₂e）：<span style="color: #3b82f6">{{ equipdata.totalCarbonEmission }}</span>
              <span style="margin-left: 16px">环比</span>
              <span v-if="equipdata.monthOnMonthRatio != null">
                <span v-if="equipdata.monthOnMonthRatio > 0" style="margin-left: 8px; color: #f87171">{{ equipdata.monthOnMonthRatio }}%</span>
                <px-icon v-if="equipdata.monthOnMonthRatio > 0" color="#F87171" style="font-size: 12px !important">
                  <Top />
                </px-icon>
                <px-icon v-if="equipdata.monthOnMonthRatio >= 30" color="#f59e0b" style="font-size: 12px !important; cursor: pointer">
                  <px-tooltip class="box-item" effect="dark" content="环比变化超过30%" placement="top"> <WarningFilled /> </px-tooltip>
                </px-icon>
                <span v-if="equipdata.monthOnMonthRatio < 0" style="margin-left: 8px; color: #10b981">{{ equipdata.monthOnMonthRatio }}%</span>
                <span v-if="equipdata.monthOnMonthRatio == 0" style="margin-left: 8px; color: #000">{{ equipdata.monthOnMonthRatio }}%</span>
                <px-icon v-if="equipdata.monthOnMonthRatio < 0" color="#10b981" style="font-size: 12px !important">
                  <Bottom />
                </px-icon>
              </span>
              <span v-else> --</span>
            </p>
            <div>
              <div v-for="item in equipdata.resultUpdateDTOS" :key="item.id" class="mianListbottom">
                <p class="mianListbottomp" />
                <p class="mianListbottomp2">
                  <span style="display: inline-block; min-width: 200px">{{ item.gasType }}排放因子：{{ item.gasType }}</span>
                  <span style="display: inline-block; min-width: 100px; margin-left: 68px"
                    >{{ item.emissionFactorValue }} {{ equipdata.factorUnit }}</span
                  >
                  <span style="display: inline-block; min-width: 200px; margin-left: 220px">排放量（tCO₂e）：{{ item.carbonEmission }}</span>
                </p>
              </div>
            </div>
          </div>
        </div>
      </div>
      <px-dialog v-model="innerVisible" width="1372" title="历史记录" append-to-body align-center>
        <px-table
          v-loading="loading"
          :data="rukuList"
          height="calc(100vh - 339px)"
          show-overflow-tooltip
          highlight-current-row
          border
          @current-change="handleSelectionChange2"
        >
          <px-table-column label="设施/活动" width="160" prop="inboundNumber">
            <template #default="scope">
              <span>{{ scope.row.facilityName }}</span>
            </template>
          </px-table-column>
          <px-table-column label="活动水平" prop="gasType">
            <template #default="scope">
              <span>{{ scope.row.activityLevel ? `${scope.row.activityLevel}${scope.row.activityLevelUnit}` : "-" }}</span>
            </template>
          </px-table-column>
          <px-table-column label="CO₂e排放因子" prop="value">
            <template #default="scope">
              <span>{{ scope.row.co2eFactorValue }}</span>
            </template>
          </px-table-column>
          <px-table-column label="排放总量（tCO₂e）" prop="unit">
            <template #default="scope">
              <span>{{ scope.row.totalCarbonEmission }}</span>
            </template>
          </px-table-column>
          <px-table-column label="环比变化" prop="factorSource">
            <template #default="scope">
              <span>{{ scope.row.momValue }}%</span>
            </template>
          </px-table-column>

          <px-table-column label="活动水平记录方式" prop="gasType">
            <template #default="scope">
              <span>{{ scope.row.activityLevelSource }}</span>
            </template>
          </px-table-column>

          <px-table-column label="凭证材料" prop="factorSource">
            <template #default="scope">
              <span v-if="scope.row.fileDTOS?.length > 0" class="pdfColor" @click="showPdf(scope.row.fileDTOS)">{{
                scope.row.fileDTOS[0].originalName
              }}</span>
              <span v-else>-</span>
            </template>
          </px-table-column>
          <px-table-column label="修改人" prop="factorSource">
            <template #default="scope">
              <span>{{ scope.row.updateByName }}</span>
            </template>
          </px-table-column>
          <px-table-column label="修改时间" prop="factorSource">
            <template #default="scope">
              <span>{{ scope.row.updateTime }}</span>
            </template>
          </px-table-column>
          <template #empty>
            <px-empty :image-size="150" />
          </template>
        </px-table>

        <pagination
          v-show="total2 > 0"
          v-model:page="queryParams2.pageNum"
          v-model:limit="queryParams2.pageSize"
          style="margin-bottom: -10px"
          :total="total2"
          @pagination="getRukuList"
        />
      </px-dialog>
    </px-scrollbar>
    <div v-if="addVisible" class="px-dialog-footer">
      <px-button @click="equipopenDetailcancel">取消</px-button>
      <px-button type="primary" @click="equipopenDetailsubmitForm()">保存</px-button>
    </div>
    <px-dialog v-model="pzVisible" title="选择缴费凭证" width="1600">
      <px-radio-group v-model="pzqueryParams.kind" class="tabSwitch" @change="tabSelectHandler">
        <!-- <px-radio-button v-has="`${item.permision}`" v-for="item in tabsOption" :key="item.name" :label="item.name">{{ item.label }}</px-radio-button> -->
        <px-radio-button label="electricity">电</px-radio-button>
        <px-radio-button label="water">水</px-radio-button>
        <px-radio-button label="ng">天然气</px-radio-button>
        <px-radio-button label="hotSteam">蒸汽/热水</px-radio-button>
        <px-radio-button label="gas">大宗气</px-radio-button>
        <px-radio-button label="diesel">柴油</px-radio-button>
      </px-radio-group>
      <px-table
        style="margin-top: 16px"
        :data="tableData"
        border
        show-overflow-tooltip
        height="400"
        :header-cell-style="{ background: '#e7eefb', color: '#000' }"
      >
        <px-table-column type="index" label="序号" fixed width="55" align="center" />
        <px-table-column prop="period" label="费用周期" align="center" min-width="160" />
        <px-table-column prop="version" label="周期时间" align="center" min-width="300">
          <template #default="scope">
            <div>{{ scope.row.startTime }}-{{ scope.row.endTime }}</div>
          </template>
        </px-table-column>
        <px-table-column prop="calculateCost" label="计算费用" align="center" width="100" />
        <px-table-column prop="settlement" label="结算单费用" align="center" width="120" />
        <px-table-column label="结算单-计算费用" align="center" width="160">
          <template #default="scope">
            <div>{{ scope.row.settlement - scope.row.calculateCost }}</div>
          </template>
        </px-table-column>
        <px-table-column label="选择结算凭证" align="center">
          <template #default="scope">
            <px-button type="primary" @click="viewFileVisible(scope.row)">选择缴费凭证</px-button>
          </template>
        </px-table-column>
        <px-table-column label="状态" align="center" width="100">
          <template #default="scope">
            <px-tag :type="scope.row.auditType == 'N' ? 'warning' : 'success'" class="mx-1" effect="dark">
              {{ scope.row.auditType == "N" ? "待核算" : "已核算" }}
            </px-tag>
          </template>
        </px-table-column>
        <template #empty>
          <px-empty :image-size="150" />
        </template>
      </px-table>
      <pagination
        v-show="pztotal > 0"
        v-model:page="pzqueryParams.pageNum"
        v-model:limit="pzqueryParams.pageSize"
        :total="pztotal"
        @pagination="getpzList"
      />
    </px-dialog>
    <px-dialog v-model="dialogFilesVisible" title="结算凭证" width="600" align-center>
      <px-table :data="fileData" border show-overflow-tooltip :header-cell-style="{ background: '#e7eefb', color: '#000' }">
        <px-table-column type="index" label="序号" fixed width="55" align="center" />
        <px-table-column prop="originalName" label="文件名" align="center" min-width="160">
          <template #default="scope">
            <px-button type="primary" text @click="handlePreview(scope.row)">{{ scope.row.originalName }}</px-button>
          </template>
        </px-table-column>
        <px-table-column label="操作" width="150" fixed="right" align="center">
          <template #default="scope">
            <px-button type="primary" @click="xzpzfile(scope.row)">选择</px-button>
            <!-- <px-button link icon="Download" type="primary" @click="fileDownload(scope.row)" /> -->
            <!-- <px-tooltip content="删除" placement="top">
              <px-button link icon="Delete" type="danger" @click="fileDelete(scope.row)" />
            </px-tooltip> -->
          </template>
        </px-table-column>
        <template #empty>
          <px-empty :image-size="150" />
        </template>
      </px-table>
    </px-dialog>
  </div>
</template>

<script setup name="Dict" lang="ts">
defineOptions({
  name: "SystemDataDict"
});
// import { router } from "@/router";
import { ArrowLeft } from "@px-ui/icons-vue";
import { useRoute } from "vue-router";
import { PxMessage, PxMessageBox } from "px-ui";
import { getCurrentInstance, ref, toRefs, reactive, onMounted } from "vue";
import { getToken } from "@/utils/auth";
import { queryChildByTypeCodeAndItemValue } from "@/api/waterClass";
import FileUpload from "@/components/Upload/FileUpload.vue";
import {
  emissionFactorquery,
  emissionFactorSourceList,
  emissionFactorsave,
  numberatorUnitList,
  denominatorUnitList,
  emissionFactordelete,
  emissionFactoredit,
  emissionFactordetail,
  accountingReportledger,
  accountingReportemissionDataDetail,
  accountingReporteditEmissionData,
  accountingReportrecord
} from "@/api/doubleCarbonManage/carbonAccounting";
import {
  accountingReportactivityLevelSource,
  accountingReportaccount,
  accountingReportaccountMomPercent
} from "@/api/doubleCarbonManage/accountingManage";
import importFiles from "@/views/common/components/importFiles/index.vue";
import { facilityquery } from "@/api/doubleCarbonManage/accountingList";
import { getCheckList } from "@/api/energy/costCheck";
const importFile = ref<string>("");
const submitHandler = () => {};
const jibenxinxiFlg = ref(true);
const jiqicanshuFlg = ref(true);
const numFlg = ref(true);
const setqingdanFlg = () => {
  jibenxinxiFlg.value = !jibenxinxiFlg.value;
};
const setjiqicanshuFlg = () => {
  jiqicanshuFlg.value = !jiqicanshuFlg.value;
};
const setnumFlg = () => {
  numFlg.value = !numFlg.value;
};
const defaultTime: [Date, Date] = [new Date(2000, 1, 1, 0, 0, 1), new Date(2000, 1, 1, 23, 59, 59)];
const detailruleFormRef = ref();
let facDisabled = ref(false);
onMounted(() => {
  facilityquery({
    orderByColumn: "",
    isAsc: "",
    name: "",
    category: "",
    emissionFactorName: "",
    orderBy: "",
    pageNum: 1,
    pageSize: 999
  }).then((response: any) => {
    facilityList.value = response.data;
  });
  emissionFactorquery({
    orderByColumn: "",
    isAsc: "",
    emissionFactorName: "",
    factorSource: "",
    releaseYear: "",
    orderBy: "",
    pageNum: 1,
    pageSize: 999
  }).then((response: any) => {
    emissionFactorqueryList.value = response.data;
  });
  if (localStorage.getItem("facList")) {
    let faclist = JSON.parse(localStorage.getItem("facList"));
    if (faclist.length == 1) {
      facDisabled.value = true;
      queryParams.value.level = faclist[0].name;
      getList();
    } else if (faclist.length == 2) {
      facDisabled.value = false;
      queryParams.value.level = faclist.filter(item => item.code == localStorage.getItem("facCode"))[0].name;
      getList();
    }
  }
});
const setactivityLevel = equipdata => {
  setTimeout(() => {
    if (equipdata.activityLevelSource == null) {
      equipdata.activityLevelSource = huodongList.value[0];
    }
    accountingReportaccount({
      facilityId: equipdata.facilityId,
      activityLevel: Number(equipdata.activityLevel)
    }).then(res => {
      equipdata.resultUpdateDTOS = res;
      equipdata.totalCarbonEmission = res.reduce((accumulator, currentValue) => accumulator + currentValue.carbonEmission, 0).toFixed(2);
      console.log(res);
    });
    accountingReportaccountMomPercent({
      facilityId: equipdata.facilityId,
      activityLevel: Number(equipdata.activityLevel),
      accountingMonth: `${equipdata.estimateMonth} 00:00:00`,
      templateId: equipdata.templateId
    }).then(res => {
      equipdata.monthOnMonthRatio = res;
    });
  }, 200);
};
const { proxy }: any = getCurrentInstance();
function equipopenDetailcancel() {
  if (buttonTitle.value == "编辑") {
    if (equipdata.value.activityLevel != "") {
      PxMessageBox.confirm("<p>取消将不保存当前录入信息返回上一页</p><p>确定取消吗？</p>", "温馨提示", {
        dangerouslyUseHTMLString: true,
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
        draggable: true
      })
        .then(async () => {
          addVisible.value = false;
          getList();
        })
        .catch(() => {});
    }
  } else {
    addVisible.value = false;
    getList();
  }
}
const typeList = ref([]);
const progressVisible = ref(false);
const equipopen = ref(false);
const equipopenDetail = ref(false);
const fromdisable = ref(false);
const loading = ref(true);
const showSearch = ref(true);
const dialogVisible = ref(false);
const addVisible = ref(false);
const detailVisible = ref(false);
const total = ref(0);
const total2 = ref(0);
const dateRange = ref([]);
const innerVisible = ref(false);
const liquidList = [
  {
    itemName: "全厂",
    itemValue: null
  },
  {
    itemName: "创新中心一期",
    itemValue: "创新中心一期"
  },
  {
    itemName: "创新中心二期",
    itemValue: "创新中心二期"
  }
];
const dialogFilesVisible = ref(false);
const viewFileVisible = row => {
  dialogFilesVisible.value = true;
  fileData.value = row.file || [];
};
const pzitem = ref({});
const tableLoading = ref(false);
const pzVisible = ref(false);
const pztotal = ref(0);
const getpzList = async () => {
  tableLoading.value = true;
  const res: any = await getCheckList(proxy.addDateRange(pzqueryParams.value));
  tableData.value = res.data || [];
  pztotal.value = res?.total;
  tableLoading.value = false;
};
const setpzfile = item => {
  console.log(item);
  pzitem.value = item;
  pzVisible.value = true;
  getpzList();
};
const tabSelectHandler = () => {
  getpzList();
};
const xzpzfile = row => {
  pzitem.value.fileDTOS = [row];
  pzVisible.value = false;
  dialogFilesVisible.value = false;
};
// 预览
const handlePreview = row => {
  if (row != null) {
    const { id, fileName, moduleName, fileType: type = "" } = row;
    // doc 暂不支持预览
    const allowType = ["txt", "docx", "xls", "xlsx", "pdf", "png", "jpg", "jpeg", "mp4"];
    if (!allowType.includes(type)) {
      PxMessage.error("暂不支持该格式文件的预览");
      return;
    }
    const path = "/fullScreen/preview";
    const query = { id, fileName, moduleName, type };
    const params = { path, query };
    const { href } = router.resolve(params);
    window.open(href, "_blank");
  } else {
    PxMessage.error("没有可以预览的文件");
  }
};
// 图片是否上传完，是否可以保存
const buttonTitle = ref("");
const data = reactive({
  huodongList: [],
  rukuList: [],
  transportCompanyList: [],
  receiveCompanyList: [],
  typeIdList: [],
  categoryList: [],
  equipmentTypeList: [],
  positionList: [],
  selectRukuList: [],
  okselectRukuList: [],
  equipmentDeptList: [],
  modelIdList: [],
  form: {},
  photoStatusFlag: false,
  fileStatusFlag: false,
  SourceList: [],
  zUnitList: [],
  mUnitList: [],
  equipdata: {
    id: "",
    emissionFactorName: "",
    numberatorUnit: "",
    denominatorUnit: "",
    factorSource: "",
    releaseYear: "",
    CO2: null,
    CH4: null,
    N2O: null,
    HFCs: null,
    PFCs: null,
    SF6: null,
    NF3: null,
    CO2e: null,
    factorValueDTOS: [],
    createByName: "",
    updateByName: "",
    fileDTOS: []
  },
  queryParams: {
    orderByColumn: "",
    isAsc: "",
    facilityName: "",
    emissionFactorName: "",
    level: "",
    startDate: "",
    endDate: "",
    orderBy: "",
    pageNum: 1,
    pageSize: 20
  },
  queryParams2: {
    orderByColumn: "",
    isAsc: "",
    id: "",
    orderBy: "",
    pageNum: 1,
    pageSize: 20
  },
  rules: {
    emissionFactorName: [{ required: true, message: "排放因子名称不能为空", trigger: "blur" }],
    numberatorUnit: [{ required: true, message: "排放因子单位不能为空", trigger: "change" }],
    factorSource: [{ required: true, message: "排放因子来源不能为空", trigger: "change" }],
    releaseYear: [{ required: true, message: "发布年份不能为空", trigger: "change" }],
    CO2e: [
      {
        validator: (rule: any, value: any, callback: any) => {
          if (value === null) {
            return callback(new Error("CO2e不能为空"));
          } else if (
            equipdata.value.CO2 != null ||
            equipdata.value.CH4 != null ||
            equipdata.value.N2O != null ||
            equipdata.value.HFCs != null ||
            equipdata.value.PFCs != null ||
            equipdata.value.SF6 != null ||
            equipdata.value.NF3 != null
          ) {
            if (
              Number(value) !=
              Math.round(
                Number(
                  Number(equipdata.value.CO2 == null ? 0 : equipdata.value.CO2) * 100000 +
                    Number(equipdata.value.CH4 == null ? 0 : equipdata.value.CH4) * 100000 +
                    Number(equipdata.value.N2O == null ? 0 : equipdata.value.N2O) * 100000 +
                    Number(equipdata.value.HFCs == null ? 0 : equipdata.value.HFCs) * 100000 +
                    Number(equipdata.value.PFCs == null ? 0 : equipdata.value.PFCs) * 100000 +
                    Number(equipdata.value.SF6 == null ? 0 : equipdata.value.SF6) * 100000 +
                    Number(equipdata.value.NF3 == null ? 0 : equipdata.value.NF3) * 100000
                )
              ) /
                100000
            ) {
              return callback(new Error("CO2e值必须为上面7项的总和"));
            }
          }
          callback();
        },
        trigger: "blur",
        required: true
      }
    ]
  },
  headers: {
    Authorization: "Bearer " + getToken().accessToken || ""
  },
  moduleName: "",
  dialogImageUrl: "",
  imageVisible: false,
  facilityList: [],
  emissionFactorqueryList: [],
  tableData: [],
  fileData: [],
  pzqueryParams: {
    pageNum: 1,
    pageSize: 10,
    kind: "electricity"
  }
});
const {
  tableData,
  pzqueryParams,
  fileData,
  facilityList,
  emissionFactorqueryList,
  huodongList,
  fileStatusFlag,
  queryParams2,
  SourceList,
  selectRukuList,
  zUnitList,
  mUnitList,
  queryParams,
  form,
  rules,
  equipdata,
  rukuList
} = toRefs(data);
const getqueryCategoryList = () => {
  accountingReportactivityLevelSource({}).then(res => {
    huodongList.value = res;
  });
  // queryChildByTypeCodeAndItemValue({
  //   value: "EMISSION_FACTOR_SOURCE",
  //   typeCode: "BICARBON"
  // }).then((response: any) => {
  //   SourceList.value = response;
  // });
  // queryChildByTypeCodeAndItemValue({
  //   value: "NUMBERATOR_UNIT",
  //   typeCode: "BICARBON"
  // }).then((response: any) => {
  //   zUnitList.value = response;
  // });
  // queryChildByTypeCodeAndItemValue({
  //   value: "DENOMINATOR_UNIT",
  //   typeCode: "BICARBON"
  // }).then((response: any) => {
  //   mUnitList.value = response;
  // });
};
getqueryCategoryList();
// 新的文件列表
const changeFileList = val => {
  equipdata.value.fileDTOS = val;
};
// 文件是否上传完，是否可以保存
const saveFileStatus = val => {
  fileStatusFlag.value = val;
};
const handledelAddPosition = () => {
  equipdata.value.content.push({
    content: "",
    qualified: 1
  });
  // positionVisible.value = true;
};

const gethistory = () => {
  // typeList.value = [];
  getRukuList();
  innerVisible.value = true;
};
function getRukuList() {
  loading.value = true;

  accountingReportrecord(queryParams2.value).then((response: any) => {
    rukuList.value = response.data;
    total2.value = response.total;
    loading.value = false;
  });
}
function getList() {
  loading.value = true;
  if (queryParams.value.releaseYear != null) {
    queryParams.value.startDate = queryParams.value.releaseYear[0];
    queryParams.value.endDate = queryParams.value.releaseYear[1];
  } else {
    queryParams.value.startDate = "";
    queryParams.value.endDate = "";
  }
  accountingReportledger(queryParams.value).then((response: any) => {
    typeList.value = response.data;
    total.value = response.total;
    loading.value = false;
  });
}
const removechukuList = () => {
  localStorage.removeItem("chukuList");
};
/** 取消按钮 */

/** 表单重置 */
function reset() {
  form.value = {
    id: undefined,
    dictionaryName: undefined,
    dictionaryType: undefined,
    status: "VALID",
    remarks: undefined
  };
  proxy.resetForm("dictRef");
}
/** 搜索按钮操作 */
function handleQuery(type) {
  if (type == "search") {
    queryParams.value.pageNum = 1;
  }
  getList();
}

/** 重置按钮操作 */
function resetQuery() {
  queryParams.value = {
    pageNum: queryParams.value.pageNum,
    pageSize: queryParams.value.pageSize,
    orderByColumn: "",
    isAsc: "",
    facilityId: "",
    emissionFactorId: "",
    level: "",
    startDate: "",
    endDate: "",
    orderBy: ""
  };
  if (localStorage.getItem("facList")) {
    let faclist = JSON.parse(localStorage.getItem("facList"));
    if (faclist.length == 1) {
      facDisabled.value = true;
      queryParams.value.level = faclist[0].name;
      // getList()
    } else if (faclist.length == 2) {
      facDisabled.value = false;
      queryParams.value.level = faclist.filter(item => item.code == localStorage.getItem("facCode"))[0].name;
      // getList()
    }
  }
  dateRange.value = [];
  handleQuery("reset");
}

/** 新增按钮操作 */
function handleAdd() {
  buttonTitle.value = "新增";
  addVisible.value = true;
  equipdata.value = {
    id: "",
    emissionFactorName: "",
    numberatorUnit: "",
    denominatorUnit: "",
    factorSource: "",
    releaseYear: "",
    CO2: null,
    CH4: null,
    N2O: null,
    HFCs: null,
    PFCs: null,
    SF6: null,
    NF3: null,
    CO2e: null,
    factorValueDTOS: [],
    createByName: "",
    updateByName: "",
    fileDTOS: []
  };
}
const handleDetail = async val => {
  queryParams2.value.id = val;
  equipdata.value = {};
  detailVisible.value = true;
  const data = await accountingReportemissionDataDetail({ id: val });
  equipdata.value = data;
  if (data?.fileDTOS && data?.fileDTOS.length > 0) {
    data?.fileDTOS.forEach(item => {
      item.url = item.fileUrl;
      item.name = item.originalName;
    });
    equipdata.value.fileDTOS = data?.fileDTOS;
  } else {
    equipdata.value.fileDTOS = [];
  }
};

const handleEditor = async val => {
  queryParams2.value.id = val;
  equipdata.value = {};
  buttonTitle.value = "编辑";
  addVisible.value = true;

  const data = await accountingReportemissionDataDetail({ id: val });
  console.log(data);
  equipdata.value = data;
  if (data?.fileDTOS && data?.fileDTOS.length > 0) {
    data?.fileDTOS.forEach(item => {
      item.url = item.fileUrl;
      item.name = item.originalName;
    });
    equipdata.value.fileDTOS = data?.fileDTOS;
  } else {
    equipdata.value.fileDTOS = [];
  }
};
/** 多选框选中数据 */
function handleSelectionChange2(selection) {
  // console.log(selection);
  selectRukuList.value = selection;
}

// const addRukudetails = () => {
//   equipdata.value.details = [...equipdata.value.details, ...selectRukuList.value];
//   let seenIds = new Set();
//   let uniqueArr = [];
//   equipdata.value.details.forEach(obj => {
//     if (!seenIds.has(obj.inboundNumber)) {
//       uniqueArr.push(obj);
//       seenIds.add(obj.inboundNumber);
//     }
//   });
//   equipdata.value.details = [];
//   if (setChukuList(uniqueArr) == true) {
//     progressVisible.value = false;
//     equipdata.value.details = uniqueArr;
//   }
// };

let setChukuList = uniqueArr => {
  if (uniqueArr.length === 0) {
    PxMessage({
      message: "请选择要出库的数据",
      type: "error"
    });
    return false;
  }
  const firstname = uniqueArr[0].wasteName;
  for (let i = 1; i < uniqueArr.length; i++) {
    if (uniqueArr[i].wasteName != firstname) {
      PxMessage({
        message: "请选择相同的废弃物",
        type: "error"
      });
      return false;
    }
  }
  return true;
};

/** 提交按钮 */

const equipopenDetailsubmitForm = () => {
  PxMessageBox.confirm("保存后将更新碳排放数据确定保存吗？", "温馨提示", {
    dangerouslyUseHTMLString: true,
    confirmButtonText: "确定",
    cancelButtonText: "取消",
    type: "warning",
    draggable: true
  })
    .then(async () => {
      accountingReporteditEmissionData(equipdata.value).then(res => {
        console.log(res);
        PxMessage({
          message: "修改成功",
          type: "success"
        });
        addVisible.value = false;
        getList();
      });
    })
    .catch(() => {});
};
import { useRouter } from "vue-router";
const router = useRouter();
const showPdf = row => {
  if (row != null) {
    const { id, fileName, moduleName, fileType: type = "" } = row[0];
    // doc 暂不支持预览
    const allowType = ["txt", "docx", "xls", "xlsx", "pdf", "png", "jpg", "jpeg", "mp4"];
    if (!allowType.includes(type)) {
      PxMessage.error("暂不支持该格式文件的预览");
      return;
    }
    const path = "/fullScreen/preview";
    const query = { id, fileName, moduleName, type };
    const params = { path, query };
    const { href } = router.resolve(params);
    window.open(href, "_blank");
  } else {
    PxMessage.error("没有可以预览的文件");
  }
};
/** 删除按钮操作 */
function handleDelete(row) {
  console.log(row);
  PxMessageBox.confirm('是否确认删除"' + row.name + '"？', "温馨提示", {
    confirmButtonText: "确定",
    cancelButtonText: "取消",
    confirmButtonClass: "px-button--danger",
    type: "warning",
    draggable: true
  })
    .then(async () => {
      const data = await emissionFactordelete({ id: row.id });
      PxMessage({
        message: "删除成功",
        type: "success"
      });
      getList();
    })
    .catch(() => {});
}

/** 导出按钮操作 */
function handleExport() {
  // const dictIds = [];
  // dictIds.push(...ids.value);
  // const params = { ids: dictIds };
  // proxy.download("post", "/operation/api/v1/water/hazardWasteOut/export", params, "危险废弃物出库.xlsx");
  dialogVisible.value = true;
}
</script>
<style scoped lang="scss">
.addEquip {
  position: absolute;
  top: 0;
  top: 5px;
  left: 0;
  width: calc(100% - 48px);
  height: calc(100% - 40px);
  margin: 24px;
  background: white;
}

.editorEquip {
  position: absolute;
  top: 0;
  top: 5px;
  left: 0;
  width: calc(100% - 48px);
  height: calc(100% - 40px);
  margin: 24px;
  background: white;
}

.px-dialog-footer {
  position: absolute;
  bottom: 0;
  left: 0;
  z-index: 2002;
  width: 100%;
  height: 50px;
  padding-top: 10px;
  padding-right: 34px;
  text-align: right;
  background: white;
  box-shadow: 0 0 10px 0 rgb(0 0 0 / 16%);
}

.card-header {
  min-height: 40px;
  padding: 14px 15px 7px !important;
  cursor: pointer;
  user-select: none;
  background: #e7eefb;
}

.card-title {
  float: left;
  line-height: 14px;
}

.card-main {
  float: left;
  margin: -3px 8px 0 5px;
  cursor: pointer;
}

.box-card1 {
  width: calc(100% - 48px);
  margin: 24px;
  overflow: hidden;
  border: 1px solid #dfdfdf;
  border-radius: 4px;
}

.box-card2 {
  width: calc(100% - 48px);
  margin: 24px;
  overflow: hidden;
  border: 1px solid #dfdfdf;
  border-radius: 4px;
}

.box-card3 {
  width: calc(100% - 48px);
  margin: 24px;
  overflow: hidden;
  border: 1px solid #dfdfdf;
  border-radius: 4px;
}

.box-card4 {
  width: calc(100% - 48px);
  height: 261px;
  margin: 24px;
  overflow: hidden;
  border: 1px solid #dfdfdf;
  border-radius: 4px;
}

.demo-form-inline {
  .px-input {
    --px-input-width: calc(100% - 70px);
  }

  .px-form-item {
    width: 100%;
  }

  .px-textarea__inner {
    width: calc(100% - 100px) !important;
  }

  .px-form-item__label {
    font-weight: 400 !important;
  }
}

.form-div {
  padding: 24px;
  padding-bottom: 0;

  .px-row {
    margin-bottom: 16px;
  }
}

.px-icon {
  font-size: 16px !important;
}

:deep(.px-tabs--top .px-tabs__item.is-top.is-active) {
  border: none;

  .pane-bottom {
    line-height: 30px;
    border-bottom: 2px solid #3b82f6;
  }
}

:deep(.px-tabs .px-tabs__item) {
  .pane-bottom {
    line-height: 30px;
  }
}

.pane-line {
  position: absolute;
  top: 12px;
  right: 0;
  height: 15px;
  color: #dcdcdc;
  border-left: 1px solid #dcdcdc;
}

:deep(.custom-form-ui .px-form-item) {
  width: 250px !important;
}

.filename {
  position: absolute;
  bottom: -30px;
  width: 96px;
  overflow: hidden;
  color: rgb(166 167 172);
  text-overflow: ellipsis;
  white-space: nowrap;
}

:deep(.px-descriptions__label.px-descriptions__cell.is-bordered-label) {
  width: 166px;
  background: #e7eefb;
  border: 1px solid #dfdfdf;
}

:deep(.px-descriptions__body .px-descriptions__table.is-bordered .px-descriptions__cell) {
  border: 1px solid #dfdfdf;
}

.cell-item {
  text-align: right;
}

:deep(.px-table__header) {
  thead {
    tr {
      background-color: #e7eefb !important;

      th {
        font-size: 13px;
        font-weight: bold;
        color: #000;
        background-color: #e7eefb !important;
      }
    }
  }
}

:deep(.px-table--isfixedHeader .px-table__header-wrapper .px-table-fixed-column--right) {
  background-color: #e7eefb !important;
}

.import-bottle {
  .import-bottle-title {
    box-sizing: border-box;
    display: flex;
    align-items: center;
    width: 100%;
    height: 40px;
    padding-left: 16px;
    margin-bottom: 24px;
    line-height: 1;
    color: #333;
    background-color: #fef5e6;
    border: 1px solid #f7b648;
    border-radius: 6px;

    .download {
      color: #3b82f6;
      cursor: pointer;
    }
  }

  .import-bottle-upload {
    width: 100%;
  }
}

.mainlist {
  width: 100%;
  height: 150px;

  .mainlistTop {
    position: relative;
    width: 100%;
    height: 40px;
    font-size: 14px;
  }

  .mainlistTopp {
    position: absolute;
    top: 2px;
    left: 20px;
  }
}

.mianListbottom {
  position: relative;
  width: 100%;
  height: 40px;
  margin-top: -8px;
  margin-left: 8px;
}

.mianListbottomp {
  width: 20px;
  height: 37px;
  border-bottom: 1px solid#3B82F6;
  border-left: 1px solid#3B82F6;
}

.mianListbottomp2 {
  position: absolute;
  top: 26px;
  left: 28px;
}

.level1 {
  // width: 52px;
  height: 24px;
  padding: 0 5px;
  margin: 0 auto;
  color: #ae6f06;
  text-align: center;
  background: #f59e0b8a;
  border: 1px solid #f59e0b;
  border-radius: 4px;
}

.level2 {
  // width: 52px;
  height: 24px;
  padding: 0 5px;
  margin: 0 auto;
  text-align: center;
  background: #fcf6ec;
  border: 1px solid #fda620;
  border-radius: 4px;
}

.level3 {
  // width: 52px;
  height: 24px;
  padding: 0 5px;
  margin: 0 auto;
  text-align: center;
  background: #eff6ff;
  border: 1px solid #3b82f6;
  border-radius: 4px;
}

.pdfColor {
  color: #3b82f6;
  cursor: pointer;
}
</style>
